package com.chaoyong.higo.adapter;

import java.util.ArrayList;

import com.chaoyong.higo.R;

import android.R.integer;
import android.app.Activity;
import android.support.v7.widget.RecyclerView.Adapter;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class WinningNoAdapter extends Adapter<WinningNoAdapter.MyViewHolder> {
	
	private ArrayList<Integer> datas;
	private Activity act;
	private LayoutInflater inflater;
	
	public WinningNoAdapter(Activity act, ArrayList<Integer> datas) {
		// TODO Auto-generated constructor stub
		this.act = act;
		this.datas = datas;
		inflater = LayoutInflater.from(act);
	}
	
	public void changeData(ArrayList<Integer> datas){
		this.datas = datas;
		this.notifyDataSetChanged();
	}
	
	class MyViewHolder extends ViewHolder{

		TextView mTextView;
		
		public MyViewHolder(View arg0) {
			super(arg0);
			// TODO Auto-generated constructor stub
			mTextView = (TextView) arg0.findViewById(R.id.item_number_tx);
		}
	}

	@Override
	public int getItemCount() {
		// TODO Auto-generated method stub
		return datas.size();
	}

	@Override
	public void onBindViewHolder(MyViewHolder arg0, int arg1) {
		// TODO Auto-generated method stub
		arg0.mTextView.setText(datas.get(arg1) + "");
	}

	@Override
	public MyViewHolder onCreateViewHolder(ViewGroup arg0, int arg1) {
		// TODO Auto-generated method stub
		MyViewHolder holder = new MyViewHolder(inflater.inflate(R.layout.item_prodetail_number, arg0, false));
		
		return holder;
	}

	class VV{
	}
}
